package main

import (
	"fmt"

	"gitee.com/thubcc/rtlmmap/web"
)

var (
	maps = map[string]string{
		"gettuner":   "GetTuner",
		"settuner":   "SetPPM",
		"spectrum":   "Spectrum",
		"suspend":    "Suspend",
		"start":      "Start",
		"stop":       "Stop",
		"resume":     "Resume",
		"fc":         "SetFc",
		"gain":       "SetGain",
		"afc":        "AFC",
		"ltepss":     "SearchPSS",
		"ltescan":    "ScanRefSym",
		"ltepeak":    "CellPeak",
		"ltecfo":     "CellCFO",
		"resetppm":   "ResetPPM",
		"ltepeakall": "ScanRef",
		"ltechannel": "Channel",
	}
)

func HandleInit() {
	routers["/list"] = web.HList
	routers["/plist"] = web.GlobPorts.PList
	routers["/lteh"] = web.HChannel
	routers["/new/:handle"] = web.GlobHandles.NewHandle
	for k, v := range maps {
		routers[fmt.Sprintf("/%s/:handle", k)] = web.GlobHandles.HandleSpecificationAPI(v)
	}
	return
}
